<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="css/common.css" rel="stylesheet" type="text/css"/>
    <link href="css/style.css" rel="stylesheet" type="text/css"/>
    <link href="css/jquery-labelauty.css" rel="stylesheet" type="text/css"/>
    <script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="js/jquery.SuperSlide.2.1.1.js" type="text/javascript"></script>
    <script src="js/common_js.js" type="text/javascript"></script>
    <script src="js/footer.js" type="text/javascript"></script>
    <script src="js/jquery-labelauty.js" type="text/javascript"></script>
    <!-- 自定义工具-->
    <script type="text/javascript" src="js/HttpUtil.js"></script>
    <!--参数校验工具-->
    <script src="validation-1.19.2/jquery.validate.min.js"></script>
    <script src="validation-1.19.2/localization/messages_zh.min.js"></script>

    <!--导入vue 包-->
    <script src="vue/Vue.v2.6.12.js"></script>
    <script type="text/javascript" src="js/HttpUtil.js"></script>

    <!-- 引入样式Element -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="js/user.check.login.js"></script>

    <title>发布商品</title>
</head>

<body>
<head>
    <div id="header_top">
        <div id="top">
            <div class="Inside_pages" id="div_header">
                <div class="Collection"><a href="#.html" class="green" v-model="userName">欢迎商家会员：{{userName}}</a> <a
                        href="javascript:void(0)"
                        @click="cancellation" class="green">退出</a></div>
            </div>
        </div>
    </div>
    <div id="header" class="header page_style">
        <div class="logo"><a href="index.html"><img src="images/logo.png"/></a></div>

        <!--结束图层-->
        <div class="Search">
            <div class="search_list">
                <ul>
                    <li class="current"><a href="#">产品</a></li>
                    <li><a href="#">信息</a></li>
                </ul>
            </div>
            <div class="clear search_cur">
                <input name="searchName" id="searchName" class="search_box" onkeydown="keyDownSearch()" type="text">
                <input name="" type="submit" value="搜 索" class="Search_btn"/>
            </div>
            <div class="clear hotword">热门搜索词：香醋&nbsp;&nbsp;&nbsp;茶叶&nbsp;&nbsp;&nbsp;草莓&nbsp;&nbsp;&nbsp;葡萄&nbsp;&nbsp;&nbsp;菜油</div>
        </div>

    </div>

    <!--菜单栏-->
    <div class="Navigation" id="Navigation" style="padding-left: 420px;">
        <ul class="Navigation_name">
            <li><a href="index.html">首页</a></li>
            <li class="hour"><a href="半小时圈主页.html">半小时生活圈</a></li>
            <li><a href="产品-产品列表(预售).html">预售专区</a><em class="hot_icon"></em></li>
            <li><a href="店铺首页.html">好评商户</a></li>
            <li><a href="goodsList.html">热销活动</a></li>
            <li><a href="">联系我们</a></li>
        </ul>
    </div>
    <script>$("#Navigation").slide({titCell: ".Navigation_name li", trigger: "click"});</script>
    </div>
</head>
<!--发布商品样式-->
<div class="Inside_pages clearfix">
    <div class="left_style">
        <!--列表-->
        <div class="menu_style">
            <ul class="menu_list">
                <li class="on"><em></em><a href="店铺专区.html">店铺专区</a></li>
                <li><em></em><a href="goods_division.html">商品专区</a></li>
                <li><em></em><a href="order_manage.html">订单专区</a></li>
                <li><em></em><a href="发货管理.html">发货管理</a></li>
            </ul>
        </div>
    </div>
    <div class="right_style">
        <!--内容详细-->
        <div class="title_style"><em></em>发布商品</div>
        <div class="content_style">
            <div class="Release_product_style" id="table_constraint">
                <form id="form_constraint">
                    <table cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td class="label">店铺/公司名称：</td>
                            <td>小博商城</td>
                        </tr>

                        <tr>
                            <td class="label">编辑商品标题：</td>
                            <td><input id="goodsTile" v-model="goodsTile" placeholder="必填内容" name="goodsTile"
                                       type="text" class="addtext"
                                       style=" width:500px;"/></td>
                        </tr>
                        <tr>
                            <td class="label">设置商品分类：</td>
                            <td>
                                <span>一级分类：</span><select name="" size="1">
                                <option value="1">一级分类</option>
                            </select>
                                <span>二级分类：</span><select name="" size="1">
                                <option value="2">二级分类</option>
                            </select>
                                <span>三级分类：</span><select name="" size="1">
                                <option value="3">三级分类</option>
                            </select></td>
                        </tr>
                        <tr>
                            <td class="label">商品类别：</td>
                            <td>
                                <!--       <tr><td class="label">设置商品规格：</td><td>-->
                                <!--<ul class="Spec_style"><li>50ml</li><li>100ml</li><li>200ml</li><li>100g</li><li>1000g</li></ul>
                                <div class="add_Spec">
                                    <a href="#" class="add_Spec_btn"><em class="icon_1"></em>添加规格标签</a><a href="#" class="jx_btn">继续添加</a><a href="#" class="delete_btn">删除</a>
                                    &lt;!&ndash;添加标签隐藏层&ndash;&gt;
                                    <div class="spec_label_style">
                                        <div class="jx_cz_spec"><a href="#">继续添加</a> <span>最多只能添加5张图片</span></div>
                                        <div class="tianjia_label">
                                            <em class="sprite-icon"></em>
                                            <input name="" type="text"  class="addtext"  style=" width:300px;"/><input name="" type="submit" value="添加"  class="add_submit"/></div>
                                    </div>
                                </div>-->
                                <div class="Spec_label">
                                    <input name="checkbox" type="radio" v-model="typeId" data-labelauty="手机" id="a"
                                           value="1"/>
                                    <input name="checkbox" type="radio" v-model="typeId" data-labelauty="平板" id="b"
                                           value="2"/>
                                    <input name="checkbox" type="radio" v-model="typeId" data-labelauty="手表" id="c"
                                           value="3"/>
                                    <input name="checkbox" type="radio" v-model="typeId" data-labelauty="电脑" id="d"
                                           value="4"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="label">商品销售价格：</td>
                            <td><input v-model="goodsPrice" type="text" name="goodsPrice" id="goodsPrice"
                                       placeholder="必填内容（必须为数字类型）"
                                       class="addtext" style=" width:200px;"/></td>
                        </tr>
                        <tr>
                            <td class="label">商品促销价格：</td>
                            <td><input v-model="promotionPrice" type="text" id="promotionPrice" name="promotionPrice"
                                       class="addtext" placeholder="选填内容（必须为数字类型）"
                                       style=" width:200px; float:left"/> <span class="add_integral">
                    	<a id="check_agreement" href="#" class="check_agreement">可抵用积分</a>
                    	<input id="autoLoginCheck" type="hidden">
                    	<input id="agreement_tips" name="" type="text" class="auto_tips"
                               style=" width:100px; float:left"/>
                        </span></td>
                        </tr>
                        <tr>
                            <td class="label">商品销售类别：</td>
                            <td><select name="" size="1">
                                <option value="1">一级分类</option>
                            </select></td>
                        </tr>
                        <tr>
                            <td class="label">商品库存：</td>
                            <td><input id="goodsRepertory" v-model="goodsRepertory" name="goodsRepertory"
                                       class="addtext" style=" width:200px;" placeholder="必填内容（必须为数字类型）"/></td>
                        </tr>
                        <tr>
                            <td class="label">商品概要介绍：</td>
                            <td><textarea v-model="goodsPresentation" id="goodsPresentation" name="goodsPresentation"
                                          cols="" rows="" placeholder="必填内容：商品的概要介绍。该介绍将出现在商品名称下方。"
                                          class="textarea"></textarea></td>
                        </tr>
                        <tr>
                            <td class="label">商品宣传图片：</td>
                            <td>
                                <table class="Publicize_img_style">

                                    <tr class="label">
                                        <td>上传图片</td>
                                    </tr>
                                    <tr>
                                        <td style="width: 400px;">
                                            　　　　　　<!--<input type="file" class="file-uploader" name="uploadDataField"
                                                             id="FileUploader"/>-->
                                            　　　　　　
                                            <div>
                                                　　　　　　<input type="file" name="urlImg"/>
                                                <input type="button" value="提交"/>

                                                <!--                                                    　　　　　　　　<a href="javascript:void(0)" class="link-btn">选择文件</a>-->

                                                　　　　
                                            </div>
                                        </td>

                                    </tr>

                                </table>
                            </td>
                        </tr>

                    </table>


                    <input type="button"
                           style="width:180px; height: 60px; margin-left: 420px;background-color: #9acfea; border: 0px"
                           @click="formSubmit()" value="提交商品资料">

                    <!--         使用input标签提交数据：提交数据的同时执行ajax语句-->

                </form>


            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $(':input').labelauty();
    });
</script>
<!--网站地图-->
<div class="fri-link-bg clearfix">
    <div class="fri-link">
        <div class="logo left margin-r20"><img src="images/fo-logo.jpg" width="152" height="81"/></div>
        <div class="left"><img src="images/qd.jpg" width="90" height="90"/>
            <p>扫描下载APP</p>
        </div>
        <div class="">
            <dl>
                <dt>新手上路</dt>
                <dd><a href="#">售后流程</a></dd>
                <dd><a href="#">购物流程</a></dd>
                <dd><a href="#">订购方式</a></dd>
                <dd><a href="#">隐私声明 </a></dd>
                <dd><a href="#">推荐分享说明 </a></dd>
            </dl>
            <dl>
                <dt>配送与支付</dt>
                <dd><a href="#">保险需求测试</a></dd>
                <dd><a href="#">专题及活动</a></dd>
                <dd><a href="#">挑选保险产品</a></dd>
                <dd><a href="#">常见问题 </a></dd>
            </dl>
            <dl>
                <dt>售后保障</dt>
                <dd><a href="#">保险需求测试</a></dd>
                <dd><a href="#">专题及活动</a></dd>
                <dd><a href="#">挑选保险产品</a></dd>
                <dd><a href="#">常见问题 </a></dd>
            </dl>
            <dl>
                <dt>支付方式</dt>
                <dd><a href="#">保险需求测试</a></dd>
                <dd><a href="#">专题及活动</a></dd>
                <dd><a href="#">挑选保险产品</a></dd>
                <dd><a href="#">常见问题 </a></dd>
            </dl>
            <dl>
                <dt>帮助中心</dt>
                <dd><a href="#">保险需求测试</a></dd>
                <dd><a href="#">专题及活动</a></dd>
                <dd><a href="#">挑选保险产品</a></dd>
                <dd><a href="#">常见问题 </a></dd>
            </dl>
            <dl>
                <dt>帮助中心</dt>
                <dd><a href="#">保险需求测试</a></dd>
                <dd><a href="#">专题及活动</a></dd>
                <dd><a href="#">挑选保险产品</a></dd>
                <dd><a href="#">常见问题 </a></dd>
            </dl>
            <dl>
                <dt>帮助中心</dt>
                <dd><a href="#">保险需求测试</a></dd>
                <dd><a href="#">专题及活动</a></dd>
                <dd><a href="#">挑选保险产品</a></dd>
                <dd><a href="#">常见问题 </a></dd>
            </dl>
        </div>
    </div>
</div>
<!--网站地图END-->
<!--网站页脚-->
<div class="copyright">
    <div class="copyright-bg">
        <div class="hotline">为生活充电在线 <span>招商热线：****-********</span> 客服热线：400-******</div>
        <div class="hotline co-ph">
            <p>版权所有Copyright ©***************</p>
            <p>*ICP备***************号 不良信息举报</p>
            <p>总机电话：****-*********/194/195/196 客服电话：4000****** 传 真：********

                <a href="http://www.mycodes.net/" target="_blank">源码之家</a></p>
        </div>
    </div>
</div>
</body>
</html>
<script>

    let vt = new Vue({
        el: '#div_header',
        data: {
            userName: "",
        },
        methods: {
            //cookie值
            cookieNumber: function () {
                let cookieNum = getCookie("userMassage");
                let user = JSON.parse(cookieNum);
                var userNameValue = user.userName;

                this.userName = userNameValue;

            },
            // 手动绑定click
            // 登出
            cancellation: function () {
                delCookie("userMassage");
                location.href = "login.html";
            },
        },
        mounted: function () {
            this.cookieNumber();
        }
    });

    let vue = new Vue({
        el: '#table_constraint',
        data: {
            //商品标题
            goodsTile: "",
            //商品类别
            typeId: "",
            //商品价格
            goodsPrice: "",
            //商品促销价
            promotionPrice: "",
            //商品描述
            goodsPresentation: "",
            //商品库存
            goodsRepertory: "",
            //图片
            urlImg: "",
        },
        methods: {
            formSubmit: function () {
                //发起http请求
                let url = "/addGoods.do";
                let params = {
                    goodsTitle: this.goodsTile, typeId: this.typeId, goodsPrice: this.goodsPrice,
                    promotionPrice: this.promotionPrice, goodsRepertory: this.goodsRepertory,
                    goodsPresentation: this.goodsPresentation,
                };
                // console.log(isNaN(params.goodsRepertory));
                // console.log(!isNaN(params.goodsRepertory));
                if (params.goodsTitle == "") {
                    alert("您输入的标题为空！");
                    return;
                }
                if (params.goodsPrice == "") {
                    alert("您输入的价格为空！");
                    return;
                }
                if (isNaN(params.goodsPrice)) {
                    alert("价格只能为数字！");
                    return;
                }
                if (params.promotionPrice != "") {
                    if (isNaN(params.promotionPrice)) {
                        alert("促销价格只能为数字！");
                        return;
                    }
                }
                if (params.goodsRepertory == "") {
                    alert("您输入的库存为空！");
                    return;
                }
                if (isNaN(params.goodsRepertory)) {
                    alert("库存只能为数字");
                    return;
                }
                if (params.goodsPresentation == "") {
                    alert("您的商品描述为空！");
                    return;
                }
                postWithJson(url, params, function (data) {
                    if (data != 1) {
                        alert("繁忙中！");
                        return;
                    }
                    alert("发布完成！");
                    location.href = "goods_division.html";
                })
            }
        },
        mounted: function () {

        }
    });

</script>